package com.djt.book_system.controller;

import com.djt.book_system.entity.index;
import com.djt.book_system.service.IndexService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("index")
public class IndexController {
    @Resource
    private IndexService indexService;
    @GetMapping("indexData")
    public index indexData(){
        return indexService.indexData();
    }
    @GetMapping("dateBorrows")
    public int[] dateBorrows(){
        int[] nums = new int[6];
        for (int i = 0; i < 6; i++) {
            int num = indexService.dateBorrows(i);
            nums[i] = num;
        }
        return nums;
    }
}
